snapcraft download debian package from incorrect arch
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
Hi,
I am using snapcraft 7.3.1 revision 8931 to build a gadget snap on a focal vagrant environment, and here is the snapcraft.yaml
"""
name: test-gadget
base: core22
version: 22-0.1
summary: test
description: |
test only
type: gadget
architectures:
- build-on: amd64
build-for: arm64
confinement: strict
grade: stable
package-repositories:
- type: apt
architectures: [ arm64 ]
components: [ main ]
suites: [ jammy, jammy-security, jammy-updates, jammy-backports ]
key-id: F6ECB3762474EDA9D21B7022871920D1991BC93C
url: http://ports.ubuntu.com/ubuntu-ports
parts:
prepare-device-deps:
plugin: nil
stage-packages:
- bsdmainutils:arm64
stage:
- usr/bin/hexdump
"""
After the snap is built successfully, it turns out that the bsdmainutils downloaded is actually from amd64 instead of arm64.
I have done some investigation and come up with two potential solution
1. the python-apt somehow return a amd64 package name in "get_providing_packages()" in "python-apt/apt/cache.py", so maybe we can try to check the arch before return the list. However, the "mark_packages()" in "craft_parts/packages/apt_cache.py" will also need to check the length of returned list first instead of accessing the first element directly
2. maybe check the arch in the "mark_packages()" in "craft_parts/packages/apt_cache.py"
Please let me know if you need any further info from me, any suggestions for how to fix is very welcome, and I am happy to try to provide fix with PR as well if there is a plan on how to fix
Evaluation history
No evaluation history available.